<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/jsp/ningbo/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport"
	content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="email=no" />
<meta name="format-detection" content="address=no;">
<title>定点机构查询</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/jsp/ningbo/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/jsp/ningbo/css/news.css">
<link rel="stylesheet" type="text/css" href="http://static.epasima.com/assets/js/lib/layer/layer.css" />

</head>
<body>
<input type="hidden" id="itemValId" value="${types}">
	<main class="body">
	<%-- <header id="header">
			<span>
			<img alt="宁波人社局" src="<%=request.getContextPath()%>/jsp/ningbo/images/top_logo.png" width="35" height="35">
			</span>
	<h1>${item}</h1>
	</header> 
	<!-- head end -->
	<div class="mt50"></div> --%>
	<!-- main start -->
	<div class="search">   
        <fieldset class="search">
             <input type="text"  class="box" name="s" id="searchId" placeholder="请输入关键字">
              <button id="btnpx" class="btn" title="SEARCH" onclick="searchData()">&nbsp;</button>
        </fieldset>
     </div>
	<div class="newsbox" >
		<c:if test="${types=='5'}">
			  <ul id="thelist" class="list_news3">
				<c:if test="${not empty arear_yiliaojg_list}">
				<c:forEach var="arear_yiliaojg" items="${arear_yiliaojg_list}">
					<li	onClick='javascript:window.location.href="<%=request.getContextPath()%>/nbwx/m/list_jigouclass_home_detail?type=5&detail_id=${arear_yiliaojg.id}"'>
						<h3>${arear_yiliaojg.yljgmc}</h3>
					</li>
				</c:forEach>
				</c:if>
				<c:if test="${empty arear_yiliaojg_list}">
      				<div class="nodata">暂无数据</div>
      			</c:if>
				</ul>
			</c:if>
			
			<c:if test="${types=='6'}">
			  <ul id="thelist" class="list_news3">
				<c:if test="${not empty arear_lishouyd_list}">
				<c:forEach var="arear_lishouyd" items="${arear_lishouyd_list}">
					<li	onClick='javascript:window.location.href="<%=request.getContextPath()%>/nbwx/m/list_jigouclass_home_detail?type=6&detail_id=${arear_lishouyd.id}"'>
						<h3>${arear_lishouyd.yljgmc}</h3>
					</li>
				</c:forEach>
				</c:if>
				<c:if test="${empty arear_lishouyd_list}">
      				<div class="nodata">暂无数据</div>
      			</c:if>
				</ul>
			</c:if>
		<div class="bg_gray10"></div>
		<div class="bottom_load" id="loadMore" onclick="loadMore();">点击加载更多</div>
	</div>
	<!-- main end --> </main>
	<script type="text/javascript" src="<%=request.getContextPath()%>/jsp/ningbo/js/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="http://static.epasima.com/assets/js/lib/layer/layer.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/jsp/ningbo/js/common.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/jsp/ningbo/js/bootstrap-select.js"></script>
</body>

<script type="text/javascript">
var commitFlag_A = "1";
var startNum=0;
var pageSize=15;
var noDataFlag="1";//默认是还有数据
function loadMore(){
		if(commitFlag_A!="1"){
			return "";
		}
		if(noDataFlag=="2"){
			return""
		}
		$("#loadMore").html("Loading...");
		commitFlag_A = "2";
		startNum = startNum+pageSize;
		var name = $("#searchId").val();
		var data = {};
		data.startNum = startNum+"";
		var showResultDataObj = $("#thelist");
		var item = $("#itemValId").val();
		$.ajax({
			url : ctxPath+'/nbwx/m/list_dingdianMore?type='+item+'&name='+encodeURI(name),
			type : 'post',
			data : data,
			dataType : 'html',
			ifModified : true,
			cache : false,
			success : function(data) {
				commitFlag_A = "1";
				data = $.parseJSON(data);
				var tempObj=eval(data.model); 
				if(tempObj!=null&&tempObj.length>0){
					if(item=="5"){
						var htmlStr ="";
						for(var i=0;i<tempObj.length;i++){ 
							var itemInfo  = tempObj[i];
							htmlStr +="<li onClick=javascript:window.location.href='<%=request.getContextPath()%>/nbwx/m/list_jigouclass_home_detail?type=5&detail_id="+itemInfo.id+"'>"; 
							htmlStr +="<h3>"+itemInfo.yljgmc+"</h3>";
							htmlStr +="</li>";
						}	
						if(tempObj.length==pageSize){
							noDataFlag="1";
							$("#loadMore").html("点击加载更多");
						}else if(tempObj.length<pageSize){
							noDataFlag="2";
							$("#loadMore").html("加载已完成!");
						}
						showResultDataObj.append(htmlStr);
					}else if(item=="6"){
						var htmlStr ="";
						for(var i=0;i<tempObj.length;i++){ 
							var itemInfo  = tempObj[i];
							htmlStr +="<li onClick=javascript:window.location.href='<%=request.getContextPath()%>/nbwx/m/list_jigouclass_home_detail?type=6&detail_id="+itemInfo.id+"'>"; 
							htmlStr +="<h3>"+itemInfo.yljgmc+"</h3>";
							htmlStr +="</li>";
						}	
						if(tempObj.length==pageSize){
							noDataFlag="1";
							$("#loadMore").html("点击加载更多");
						}else if(tempObj.length<pageSize){
							noDataFlag="2";
							$("#loadMore").html("加载已完成!");
						}
						showResultDataObj.append(htmlStr);
					}	
				}else{
					noDataFlag="2";
					showResultDataObj.html("");
					$("#loadMore").html("未查询到数据!");
				}
			}
		});   	
 }
 
var commitFlag="1";
function searchData(){
	if(commitFlag=="2"){
		return"";
	}
	startNum=0;
	var data = {};
	data.startNum = startNum;
	commitFlag="2";
	var name = $("#searchId").val();
	var showResultDataObj = $("#thelist");
	var type=$("#itemValId").val();
	console.log(type);
	$.ajax({
		url : ctxPath+'/nbwx/m/list_dingdianMore?type='+type+'&name='+encodeURI(name),
		type : 'post',
		data : data,
		dataType : 'html',
		ifModified : true,
		cache : false,
		success : function(data) {
			console.log(data);
			commitFlag = "1";
			data = $.parseJSON(data);
			var tempObj=eval(data.model); 
			if(tempObj!=null&&tempObj.length>0){
				if(type=="5"){
					var htmlStr ="";
					for(var i=0;i<tempObj.length;i++){ 
						var itemInfo  = tempObj[i];
						htmlStr +="<li onClick=javascript:window.location.href='<%=request.getContextPath()%>/nbwx/m/list_jigouclass_home_detail?type=5&detail_id="+itemInfo.id+"'>"; 
						htmlStr +="<h3>"+itemInfo.yljgmc+"</h3>";
						htmlStr +="</li>";
					}
					if(tempObj.length==pageSize){
						noDataFlag="1";
						$("#loadMore").html("点击加载更多");
					}else if(tempObj.length<pageSize){
						noDataFlag="2";
						$("#loadMore").html("加载已完成!");
					}
					showResultDataObj.html(htmlStr);
				}else if(type=="6"){
					var htmlStr ="";
					for(var i=0;i<tempObj.length;i++){ 
						var itemInfo  = tempObj[i];
						htmlStr +="<li onClick=javascript:window.location.href='<%=request.getContextPath()%>/nbwx/m/list_jigouclass_home_detail?type=6&detail_id="+itemInfo.id+"'>"; 
						htmlStr +="<h3>"+itemInfo.yljgmc+"</h3>";
						htmlStr +="</li>";
					}
					if(tempObj.length==pageSize){
						noDataFlag="1";
						$("#loadMore").html("点击加载更多");
					}else if(tempObj.length<pageSize){
						noDataFlag="2";
						$("#loadMore").html("加载已完成!");
					}
					showResultDataObj.html(htmlStr);
				}
			}else{
				noDataFlag="2";
				showResultDataObj.html("");
				$("#loadMore").html("未查询到数据!");
			}
		}
	});   	
}


</script>
</html>